import store from "@/store/index.js"
const uniGo = (type, params) => {
	if (params.url.indexOf('?') >= 0) {
		params.url += getQueryStr('&')
	} else {
		params.url += getQueryStr('?')
	}
	uni[type](params)
}

function getQueryStr(str) {
	const query = store.state.query;
	let result = [];
	for (let key in query) {
		result.push(key + '=' + query[key])
	}
	if (result.length > 0) {
		return str + result.join('&');
	}
	return ""
}
export default uniGo